package com.qqt.csr.im.enums;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;

import java.util.Arrays;
import java.util.Objects;

/**
 * @Author: yang hao
 * @Date: 2024/10/14 10:38
 * @Description: 消息类型，顺序不要随意变动
 **/
@Getter
public enum MsgTypeEnum {
    TextElem(0, "文本消息"),
    ImageElem(1, "图像消息"),
    FileElem(2, "文件消息"),
    VideoFileElem(3, "视频消息"),
    SystemElem(4, "系统通知"),
    ;

    private final Integer code;

    private final String desc;

    MsgTypeEnum(final Integer code, final String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static final MsgTypeEnum[] ENUMS = MsgTypeEnum.values();

    public static MsgTypeEnum matchEnum(Integer value) {
        return Arrays.stream(values()).filter(ele -> Objects.equals(ele.code, value)).findFirst().orElse(null);
    }

}
